package org.daemon.believe.mythink.bean;

public class BaseParam {

	private Integer pageNumber;
	private Integer pageSize;
	private Integer total;
	private Long id;
	private Integer offset;
	
	public Integer getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(Integer pageNumber) {
		this.pageNumber = pageNumber;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Integer getOffset() {
		return offset;
	}
	public void setOffset(Integer offset) {
		this.offset = offset;
	}
	
	public void initParam(){
		if(this.pageNumber == null || this.pageNumber.intValue() <1){
			this.pageNumber=1;
		}
		if(this.pageSize == null || this.pageSize <1){
			this.pageSize =10;
		}
		
		if(this.pageNumber !=null && this.pageNumber.intValue() > 0){
			if(this.pageSize != null && this.pageSize.intValue() > 0){
				this.offset = (this.pageNumber-1)*this.pageSize;
			}
		}
	}
}
